package com.web.tag;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.shop.entity.Dept;
import com.shop.entity.Emp;

public class IteratorAction2 extends ActionSupport {

	@Override
	public String execute() throws Exception {
		Emp emp1 = new Emp(1,"悟空","打妖怪");
		Emp emp2 = new Emp(2,"八戒","找嫦娥");
		Emp emp3 = new Emp(3,"悟净","挑担");
		Set<Emp> set1  =new HashSet<Emp>();
		set1.add(emp1);
		set1.add(emp2);
		set1.add(emp3);
		Dept dept1  =new Dept(1001,"西游记","灵山",set1);
		
		Emp emp4 = new Emp(4,"武松","打老虎");
		Emp emp5 = new Emp(5,"林冲","打高衙内");
		Emp emp6 = new Emp(6,"大郎","卖炊饼");
		Set<Emp> set2  =new HashSet<Emp>();
		set2.add(emp4);
		set2.add(emp5);
		set2.add(emp6);
		Dept dept2  =new Dept(1002,"水浒传","梁山泊",set2);
		
		Map<Dept,Set<Emp>> map = new HashMap<>();
		map.put(dept1, dept1.getEmps());
		map.put(dept2, dept2.getEmps());
		
		Map<String,Object> session = ActionContext.getContext().getSession();
		session.put("deptMap", map);
		
		return "list";
	}
	
	
	
	
}
